import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim_creatures, main, random
from util import *

description = \
"""
This gaunt figure rests wearily on his shovel.  His hands are raw and
blistered.  He clearly has been digging graves without rest for days.
"""

nagLines = [
    'Show some respect!',
    "Don't disrespect the dead, ye fool!",
    "Is nothing sacred to you, sir?",
    "Keep off the graves, son!",
    "Get a shovel in those idle hands and help!",
    "We're all dead men.",
    "Alas, poor Roderick, I knew him well.",
    "Why don't you save me some trouble, your lordship, and dig your own?",
    "Sometimes we have to put them in twice...",
    "Knave! Leave the dead in peace!",
    #"Gaze upon the fruits of thine kin!",
    "Please, sir!  Give them the dignity they could not have in life.",
]

class NPCClass(sim_creatures.NPC):
    def __init__(self):
        sim_creatures.NPC.__init__(
            self,
            'gravedigger',    # name
            parole.map.AsciiTile('@', colors['Black']), # symbol, color
            11,  # str
            8, # dex
            11,  # con
            11, # per
            10, # spd
            1,  # level
            description=description,
        )
        parole.info('New NPC: gravedigger.')

        main.schedule.listen('enter tile', self)

    def listen(self, event):
        super(NPCClass, self).listen(event)
        if event.id == 'enter tile':
            eObj, ePos, eMap = event.args
            if eMap is self.parentTile.map and eObj is main.player:
                for obj in eMap[ePos]:
                    if obj.name in ('weathered tombstone', 'hastily dug grave'):
                        self.say(random.choice(nagLines))
                        break

#========================================
thingClass = NPCClass



